package hibari.client.model;

import hibari.client.Configuration;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.gwt.user.client.rpc.IsSerializable;

@PersistenceCapable
public class DownloadToken implements IsSerializable {
	private int downloadCount = 0;

	private Date issuedDate;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long key;

	private String uuid;

	private String email;

	private Integer weekNumber = 0;

	public Integer getWeekNumber() {
		return this.weekNumber;
	}

	public void setWeekNumber(int weekNumber) {
		this.weekNumber = weekNumber;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public DownloadToken() {
	}

	public Integer getDownloadCount() {
		return this.downloadCount;
	}

	public Date getIssuedDate() {
		return this.issuedDate;
	}

	public Long getKey() {
		return this.key;
	}

	public String getUuid() {
		return this.uuid;
	}

	public void setDownloadCount(int downloadCount) {
		this.downloadCount = downloadCount;
	}

	public void setIssuedDate(Date issuedDate) {
		this.issuedDate = issuedDate;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getDownloadURL() {
		return Configuration.DOWNLOAD_PHP_URL + "?token=" + getUuid();
	}
}
